<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>康贝儿童医院预约管理系统</title>
<link href="/Public/css/bootstrap.min.css" rel="stylesheet">
<link href="/Public/css/metisMenu.css" rel="stylesheet">
<link href="/Public/css/sb-admin.css" rel="stylesheet">
<link href="/Public/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="/Public/js/datepicker/css/jquery.ui.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]>
<script src="/Public/js/html5shiv.js"></script>
<script src="/Public/js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="wrapper"> <nav class="navbar navbar-default navbar-fixed-top" role="navigation" style="margin-bottom: 0">
  <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
    <a class="navbar-brand" href="<?php echo U('Index/index');?>"><img src="/Public/images/logo.png"/></a> </div>
  <ul class="nav navbar-top-links navbar-right">
    <li> <a><i class="fa fa-user-circle-o"></i> <?php echo (session('juese')); ?></a></li>
    <li> <a><i class="fa fa-user"></i> <?php echo (session('username')); ?></a></li>
    <li> <a href="<?php echo U('Base/userex');?>"><i class="fa fa-user"></i> 修改密码</a></li>
    <li> <a href="<?php echo U('Base/logout');?>"><i class="fa fa-fw fa-power-off"></i> 退出登录</a> </li>
  </ul>
</nav>
<div class="sidebar left-sidebar" role="navigation">
  <div class="sidebar-nav navbar-collapse">
    <ul class="nav" id="side-menu">
      <?php if(is_array($menu)): $i = 0; $__LIST__ = $menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li> <a><i class="fa <?php echo ($vo["icon"]); ?> fa-fw"></i> <?php echo ($vo["qx_name"]); ?><span class="fa arrow"></span></a>
          <ul class="nav nav-second-level collapse">
            <?php if(is_array($vo['children'])): $i = 0; $__LIST__ = $vo['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><li <?php if(($v["state"]) == "0"): ?>style="display:none;"<?php endif; ?>><a href="<?php echo U("$v[url]");?>"><?php echo ($v["qx_name_1"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
          </ul>
        </li><?php endforeach; endif; else: echo "" ;endif; ?>
    </ul>
  </div>
</div>

<script src="/Public/js/jquery.js"></script> 
<link rel="stylesheet" type="text/css" href="/Public/js/layer/iCheck/flat/green.css" />
<script type="text/javascript" src="/Public/js/layer/iCheck/icheck.min.js"></script>
<link rel="stylesheet" type="text/css" href="/Public/js/layer/layer.css" />
<script src="/Public/js/bootstrap.min.js"></script> 
<script src="/Public/js/metisMenu.js"></script> 
<script src="/Public/js/sb-admin-2.js"></script> 
<script src="/Public/js/delall.js"></script> 
<script src="/Public/js/layer/bootbox.js"></script> 
<script src="/Public/js/layer/jquery-form.js"></script> 
<script src="/Public/js/layer/common.js"></script> 

  <div id="page-wrapper">
       <nav class="navbreadcrumb"><i class="fa fa-dashboard"></i> <a href="<?php echo U('Index/index');?>">首页</a> > <?php echo ($main_menu); ?> > <?php echo ($son_menu); ?><a class="flush_btn hidden-xs" href="javascript:location.replace(location.href);" title="刷新"><i class="fa  fa-repeat"></i> 刷新</a><a class="flush_btn hidden-xs" href="<?php echo U('Index/index');?>" title="返回首页"><i class="fa  fa-home"></i> 返回首页</a></nav>
    <div class="container-fluid">
      
      <form class="form-horizontal" action="<?php echo U('Booking/info_list');?>"  method="post" role="form">
        <div class="row pd-10">
          <div class="col-md-10 col-md-offset-2">
            <div class="form-group pd-0">
              <label class="col-md-1 control-label">渠道：</label>
              <div class="input-text col-md-2">
                <select name="qudao" id="qudao" class="form-control input-sm">
                  <option value="1">网络</option>
                </select>
              </div>
               <label class="control-label">登记时间从：</label>
              <div class="input-text col-md-2">
                <input type="text" name="start_date" class="form-control input-sm"  id="start_date">
              </div>
              <label class="control-label">到：</label>
              <div class="input-text col-md-2">
                <input type="text" name="en_date" class="form-control input-sm"  id="en_date">
              </div>
              <div class="col-md-2 text-center pd-top-10">
                <button type="submit" class="btn btn-primary btn-sm col-md-5 col-sm-12 col-xs-12 btn-block" id="search_btn">统计</button>
              </div>
            </div>
          </div>
        </div>
      </form>
      <div class="row">
        <div class="col-md-12">
          <div class="table-responsive">
            <table class="table table-bordered table-hover table-striped">
              <thead>
                <tr class="text-center">
                  <th>录入日期</th>
                  <?php if(is_array($posts)): $i = 0; $__LIST__ = $posts;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><th><?php echo ($vo["consult_name"]); ?></th><?php endforeach; endif; else: echo "" ;endif; ?>
                  <th>合计</th>
                </tr>
              </thead>
              <tbody>
                  <?php for($i=$riqi['start_date'];$i<=$riqi['en_date'];$i+=(24*3600)){ ?>
              
              <tr class="text-center">
                <td><a href="<?php echo U('Index/right',array('date'=>"$i"));?>" target="_blank"> <?php echo date('Y-m-d',$i); ?></a></td>
                <?php $qudao_id=$riqi['qudao_id']; $sqls="select * from bk_consult where qudao_group_name='$qudao_id'"; $postss=M()->query($sqls); foreach($postss as $v){ $time_in= strtotime(date('Y-m-d',$i + 1*24*60*60)); $consult=$v['consult_name']; ?>
                <td><?php $sql="select * from bk_kefuinfo where isorder=1 and in_time>='$i' and in_time<='$time_in' and consult='$consult'"; echo count(M()->query($sql)); ?></td>
                <?php } ?>
                <td><?php $qudao_id=$riqi['qudao_id']; $time_ins=strtotime(date('Y-m-d H:i:s',$i + 1*24*60*60)); $sqls="select * from bk_kefuinfo where isorder=1 and in_time>='$i' and in_time<='$time_ins' and qudao_group_id='$qudao_id'"; echo count(M()->query($sqls)); ?></td>
              </tr>
              <?php } ?>
              <tr class="text-center">
                <td>合计</td>
                <?php $qudao_id=$riqi['qudao_id']; $sqls="select * from bk_consult where qudao_group_name='$qudao_id'"; $postss=M()->query($sqls); foreach($postss as $v){ ?>
                <td><?php $consult=$v['consult_name']; $qudaoid=$riqi['qudao_id']; $post_start_date=$riqi['start_date']; $post_en_date=$riqi['en_date']; $time_inss=strtotime(date('Y-m-d H:i:s',$post_en_date + 1*24*60*60)); $sql="select * from bk_kefuinfo where isorder=1 and  in_time>='$post_start_date' and in_time<='$time_inss' and consult='$consult' and qudao_group_id='$qudaoid'"; echo count(M()->query($sql)); ?></td>
                <?php } ?>
                <td><?php $qudaoid=$riqi['qudao_id']; $post_start_date=$riqi['start_date']; $post_en_date=$riqi['en_date']; $time_inss=strtotime(date('Y-m-d H:i:s',$post_en_date + 1*24*60*60)); $sql="select * from bk_kefuinfo where isorder=1 and in_time>='$post_start_date' and in_time<='$time_inss'  and qudao_group_id='$qudaoid'"; echo count(M()->query($sql)); ?></td>
              </tr>
              <tr class="text-center">
                <td>百分比</td>
                <?php $qudao_id=$riqi['qudao_id']; $sqls="select * from bk_consult where qudao_group_name='$qudao_id'"; $postss=M()->query($sqls); foreach($postss as $v){ ?>
                <td><?php $consult=$v['consult_name']; $qudaoid=$riqi['qudao_id']; $post_start_date=$riqi['start_date']; $post_en_date=$riqi['en_date']; $time_inss=strtotime(date('Y-m-d H:i:s',$post_en_date + 1*24*60*60)); $sql="select * from bk_kefuinfo where isorder=1 and in_time>='$post_start_date' and in_time<='$time_inss' and consult='$consult' and qudao_group_id='$qudaoid'"; $sqls="select * from bk_kefuinfo where isorder=1 and in_time>='$post_start_date' and in_time<='$time_inss'  and qudao_group_id='$qudaoid'"; $a1=count(M()->query($sql)); $a2=count(M()->query($sqls)); $str=round($a1/$a2,2)*100; $bfb=$str."%"; echo $bfb; ?></td>
                <?php } ?>
                <td>100%</td>
              </tr>
                </tbody>
              
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script src="/Public/js/jquery.js"></script> 
<script src="/Public/js/bootstrap.min.js"></script> 
<script src="/Public/js/metisMenu.js"></script> 
<script src="/Public/js/sb-admin-2.js"></script> 
<script src="/Public/js/datepicker/js/jquery.datepicker.js"></script>
<script>
$(function(){
$("#start_date,#en_date").datepicker();   
})
</script>  
</body>
</html>